﻿using SuperX.SuperSocket.Socket.Transfer.Client;
using System.Threading.Tasks;

namespace SuperX.SuperSocket.Socket.Transfer.Client.UpLoad.Command
{
    internal class DoCheckServerComplete : UpLoadCommandBase
    {
        public override void ExecuteCommand(UpLoadClientEngine session, TransferCommandInfo commandInfo)
        {
            Task.Factory.StartNew(() =>
            {
                try
                {
                    if (session.FileUploadingEvents.OnServerTransferComplete != null)
                    {
                        session.FileUploadingEvents.OnServerTransferComplete(new System.EventArgs());
                    }
                    session.m_EndEvent.WaitOne(5000);
                    session.DoEnd();
                }
                catch
                {

                }
            });
        }

        public override string Name
        {
            get
            {
                return UpLoadOP.DoCheckServerComplete.ToString();
            }
        }
    }
}
